package cn.zc.curriculum.service.service.impl;


import cn.zc.curriculum.entity.Dto.QuestionOptionDto;
import cn.zc.curriculum.entity.QuestionOption;
import cn.zc.curriculum.service.mapper.QuestionOptionMapper;
import cn.zc.curriculum.service.service.QuestionOptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 题目选项 服务实现类
 * </p>
 *
 * @author keno
 * @since 2022-02-14
 */
@Service
public class QuestionOptionServiceImpl extends ServiceImpl<QuestionOptionMapper, QuestionOption> implements QuestionOptionService {

    @Resource
    private QuestionOptionMapper questionOptionMapper;

    /**
     * 创建题选项
     * @param questionOption
     * @return
     */
    @Override
    public boolean createQuestionOption(QuestionOption questionOption) {
        return save(questionOption);
    }

    /**
     * 更新题选项
     * @param option
     * @return
     */
    @Override
    public boolean updateQuestionOption(QuestionOption option) {
        return updateById(option);
    }

    /**
     * 删除题选项
     * @param id
     */
    @Override
    public void deleteQuestionOptionByBank(String id) {
        questionOptionMapper.deleteQuestionOptionByBank();
    }

    /**
     * 查询题选项
     * @param id
     * @return
     */
    @Override
    public List<QuestionOptionDto> findQuestionOption(String id) {
        List<QuestionOptionDto> questionOptionDto = questionOptionMapper.findQuestionOption(id);
        return questionOptionDto;
    }
}
